casper.test.begin('Test drag&drop', 2, function(test) {
  casper.start('https://www.baidu.com', function() {
    test.assertEval(function() {
      var pos = $('#box').position();
      return (pos.left == 0 && pos.top == 0);
    }, "The box is at the top");
    this.mouse.down(5, 5);
    this.mouse.move(400, 200);
    this.mouse.up(400, 200);
  });
  casper.then(function() {
    test.assertEval(function() {
      var pos = $('#box').position();
      return (pos.left == 395 && pos.top == 195);
    }, "The box has been moved");
  });
  casper.run(function() {
    test.done();
  });
});